package com.neuedu.controller;


import com.neuedu.pojo.Result;
import com.neuedu.pojo.TFamily;
import com.neuedu.pojo.THealth;
import com.neuedu.service.ITFamilyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhangsan
 * @since 2024-06-17
 */
@RestController
@RequestMapping("/family")
public class TFamilyController {
    @Autowired
    ITFamilyService familyService;
    /**
     * 按照老人Id查找家属信息
     */
    @GetMapping("/quary/{elderId}")
    public Result findByElderId(@PathVariable("elderId") int elderId){
        return familyService.findByElderId(elderId);
    }
    /**
     *修改家属信息
     */
    @PostMapping("/edit")
    public Result modifyFa(@RequestBody TFamily family){
        System.out.println(family);
        return familyService.modifyFa(family);
    }
    /**
     * 新增家属健康信息
     */
    @PostMapping("/add")
    public  Result addFa(@RequestBody TFamily family){
        return familyService.addFa(family);
    }
}
